home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Diamond Collection
/
The Diamond Collection (Software Vault)(Digital Impact).ISO
/
cdr13
/
tstse13.zip
/
DEJUSTIF.S
< prev
next >
Wrap
Text File
|
1994-11-26
|
4KB
|
141 lines
/* Cancel the effects of right-justification for SemWare's TSE
editor V2.0. To make this SAL macro operational, invoke the main
menu (F10), choose "Macro", choose "Compile" and press Enter at
"Execute Macro".
..................................................................
Prof. Timo Salmi Co-moderator of comp.archives.msdos.announce
Moderating at garbo.uwasa.fi anonymous FTP archives 193.166.120.5
Faculty of Accounting & Industrial Management; University of Vaasa
Internet: ts@uwasa.fi BBS +(358)-61-3170972; FIN-65101, Finland
*/
// The contents of a simple help, tied later to the CtrlAlt-H key
helpdef tHelpData
title = "DEJUSTIF.S HELP" // The help's caption
x = 10 // Location
y = 3
// The actual help text
" Prof. Timo Salmi's dejustify a right margin "
""
" The justify procedure in the Potpourri collection "
" justifies a paragraph based on the right margin. "
" The dejustify procedure in this macro collection "
" can be used to cancel the effect. "
""
" You can use <F11> to invoke the command menu "
" after first exiting this help. "
""
" Last updated Sat 26-November-1994 20:04:17 "
end /* tHelpData */
/* Please first get mWrapPara() from tse.ui file which comes with
TSE distribution */
proc mWrapPara()
Warn ("Plug mWrapPara() from tse.ui into JUSTIFY.S before first use ")
end mWrapPara
/* These procedures are used to weed out the superfluous spaces.
That is to dejustify right adjusted text */
// Auxiliary
proc timoGotoParagraphBegin()
BegLine()
if PosFirstNonWhite() > 0 // If we are not on an "empty" line
repeat
Up()
until PosFirstNonWhite() == 0 OR CurrLine() == 1
if PosFirstNonWhite() == 0
Down()
endif
endif
if PosFirstNonWhite() > 0
GotoColumn(PosFirstNonWhite())
endif
end
// Auxiliary
proc timoGotoParagraphEnd(integer backtrack)
BegLine()
if PosFirstNonWhite() > 0
repeat
Down()
until PosFirstNonWhite() == 0 OR CurrLine() >= NumLines()
if CurrLine() == NumLines()
EndLine()
else
if backtrack == 1
PrevChar()
endif
endif
endif
end
// Auxiliary
proc timoMakeBlock()
PushPosition()
UnmarkBlock()
timoGotoParagraphBegin()
MarkChar()
timoGotoParagraphEnd(1)
MarkChar()
PopPosition()
end
proc timoCondense()
integer i = 0
PushPosition()
mWrapPara()
PopPosition()
//
repeat
i = i + 1
timoMakeBlock()
if isBlockMarked() AND isBlockInCurrFile()
lReplace(" "," ","ln")
endif
until i == 10
UnmarkBlock()
timoGotoParagraphEnd(0)
while PosFirstNonWhite() == 0 AND CurrLine() < NumLines()
Down()
endwhile
ScrollToRow(3*Query(WindowRows)/4)
end timoCondense
// New keys and menus **************************************************
forward Menu timoCondenseMenu()
forward proc tDisableNewKeys()
// Add the new key definitions
keydef new_keys
<CtrlAlt 5> timoCondense()
<CtrlAlt 0> tDisableNewKeys()
<CtrlAlt H> QuickHelp(tHelpData)
<F11> timoCondenseMenu()
end
// Disabling the new extra keys ***************************************
proc tDisableNewKeys()
if YesNo("Disable the extra keys:") == 1 Disable(new_keys) endif
end
// The condense menu ******************************************************
Menu timoCondenseMenu()
Title = "Timo's dejustify menu"
Width = 19
x = 40
y = 3
history
"&Dejustify right margin <CtrlAlt 5>" , timoCondense()
"",,Divide
"Disable &new keys <CtrlAlt 0>" , tDisableNewKeys()
"&Help <CtrlAlt H>" , QuickHelp(tHelpData)
"This &Menu <F11>"
end /* timoCondenseMenu */
proc Main()
Enable (new_keys)
timoCondenseMenu()
end